package com.xbongbong.saas.enums.business;

import com.xbongbong.i18n.util.I18nMessageUtil;
import com.xbongbong.paas.enums.FieldTypeEnum;
import com.xbongbong.paas.enums.ScreenTypeEnum;
import com.xbongbong.saas.enums.SelectProductEnum;
import com.xbongbong.saas.enums.ShowTypeEnum;
import com.xbongbong.saas.enums.XbbRefTypeEnum;
import com.xbongbong.saas.enums.base.ContractBaseEnum;
import lombok.Getter;

import java.util.Objects;

@Getter
public enum WaitPurchaseContractEnum {

    /**
     * 一键采购
     **/
    OPTION("option_1","enum.listOption.attrName.option",FieldTypeEnum.OPTION.getType(),"option", XbbRefTypeEnum.WAIT_PURCHASE.getCode(),1),
    CONTRACT_NO(ContractBaseEnum.CONTRACT_NO.getAttr(), "enum.contract.attrName.contract_no",  FieldTypeEnum.SERIALNO.getType(),"serialNo",XbbRefTypeEnum.CONTRACT.getCode(),1),
    NAME("text_1", "enum.contract.attrName.name", FieldTypeEnum.TEXT.getType(),"text_1",XbbRefTypeEnum.CONTRACT.getCode(),2),
    LINK_CUSTOMER(ContractBaseEnum.LINK_CUSTOMER.getAttr(), "enum.contract.attrName.link_customer", FieldTypeEnum.TEXT.getType(),"text_2",XbbRefTypeEnum.CONTRACT.getCode(),3),
    CREATOR_ID(ContractBaseEnum.CREATOR_ID.getAttr(), "enum.contract.attrName.creator_id",FieldTypeEnum.CREATORID.getType(),"creatorId",  XbbRefTypeEnum.CONTRACT.getCode(),4),
    ADD_TIME(ContractBaseEnum.ADD_TIME.getAttr(), "enum.contract.attrName.add_time", FieldTypeEnum.ADDTIME.getType(),"addTime",  XbbRefTypeEnum.CONTRACT.getCode(),5),
    UPDATE_TIME(ContractBaseEnum.UPDATE_TIME.getAttr(), "updateTime", FieldTypeEnum.UPDATETIME.getType(),"updateTime",  XbbRefTypeEnum.CONTRACT.getCode(),6),
    WAIT_PURCHASE_PRODUCT("option_5","enum.listOption.attrName.wait_purchase_contract",FieldTypeEnum.CONTRACT.getType(),"waitPurchaseProduct",XbbRefTypeEnum.WAIT_PURCHASE.getCode(),7),

    ;

    private String attr;

    private String attrName;

    private Integer fieldType;

    private String saasAttr;

    private Integer linkedType;

    private Integer sort;

    WaitPurchaseContractEnum(String attr, String attrName, Integer fieldType, String saasAttr, int linkedType, int sort) {
        this.attr = attr;
        this.attrName = attrName;
        this.fieldType = fieldType;
        this.saasAttr = saasAttr;
        this.linkedType = linkedType;
        this.sort = sort;
    }
    public static Integer getSortByWaitPurchaseContractSort(String attr){
        for (WaitPurchaseContractEnum waitOutstockEnum : WaitPurchaseContractEnum.values()){
            if (Objects.equals(attr,waitOutstockEnum.getAttr())){
                return waitOutstockEnum.getSort();
            }
        }
        return 0 ;
    }



    public String getAttrName() {
        return I18nMessageUtil.getMessage(attrName);
    }



}
